﻿using System;
using System.Collections.Generic;

namespace CoreEx.Wcf.Common
{
    /// <summary>
    /// Represents a class that is capable of providing a list of types.
    /// </summary>
    public interface ITypeResolver
    {
        /// <summary>
        /// Returns a list of of types
        /// </summary>
        /// <returns><see cref="IList{Type}"/></returns>
        IEnumerable<Type> GetTypes();

        /// <summary>
        /// Gets or sets the search pattern to be used when searching for assemblies.
        /// </summary>
        string SearchPattern { get; set; }

        /// <summary>
        /// Evaluates a <see cref="Type"/> to see if it is valid in the current context.
        /// </summary>
        /// <param name="type">The <see cref="Type"/> to evaluate.</param>
        /// <returns><b>true</b> if the <see cref="Type"/> is considered valid, otherwise <b>false</b></returns>
        bool IsValidType(Type type);

        /// <summary>
        /// Allows a derived class to specify types that are not part of the loaded assemblies. 
        /// </summary>
        /// <param name="validTypes">The list of loaded types.</param>
        void ApplyCustomTypes(IList<Type> validTypes);
    }
}
